#pragma once

#include <eh.h>

static void se_trans(unsigned int code, EXCEPTION_POINTERS* pEXC){throw code;}
#define EXCEPTION_CASE(e) case EXCEPTION_## e: err = #e ; break;
#define SEH_CASE const char *err = NULL; \
switch(code){ \
	EXCEPTION_CASE(ACCESS_VIOLATION) \
	EXCEPTION_CASE(DATATYPE_MISALIGNMENT) \
	EXCEPTION_CASE(BREAKPOINT) \
	EXCEPTION_CASE(SINGLE_STEP) \
	EXCEPTION_CASE(ARRAY_BOUNDS_EXCEEDED) \
	EXCEPTION_CASE(FLT_DENORMAL_OPERAND) \
	EXCEPTION_CASE(FLT_DIVIDE_BY_ZERO) \
	EXCEPTION_CASE(FLT_INEXACT_RESULT) \
	EXCEPTION_CASE(FLT_INVALID_OPERATION) \
	EXCEPTION_CASE(FLT_OVERFLOW) \
	EXCEPTION_CASE(FLT_STACK_CHECK) \
	EXCEPTION_CASE(FLT_UNDERFLOW) \
	EXCEPTION_CASE(INT_DIVIDE_BY_ZERO) \
	EXCEPTION_CASE(INT_OVERFLOW) \
	EXCEPTION_CASE(PRIV_INSTRUCTION) \
	EXCEPTION_CASE(IN_PAGE_ERROR) \
	EXCEPTION_CASE(ILLEGAL_INSTRUCTION) \
	EXCEPTION_CASE(NONCONTINUABLE_EXCEPTION) \
	EXCEPTION_CASE(STACK_OVERFLOW) \
	EXCEPTION_CASE(INVALID_DISPOSITION) \
	EXCEPTION_CASE(GUARD_PAGE) \
	EXCEPTION_CASE(INVALID_HANDLE) \
} \
if(!err) \
	MessageBoxA(0, err, "FLUAG SEH EXCEPTION", MB_OK | MB_ICONERROR); \
exit(2);